ds_queue_dequeue

Dequeues the value from the head of the queue.

语法:

ds_queue_dequeue(id);


参数 描述
id The id of the queue to dequeue from.


Returns: Real, String, undefined


描述

This function will dequeue the head value off of the ds_queue, removing it from the queue and returning the value to be stored in a variable. If the queue is empty then the function will return the constant undefined, otherwise it will return the real or string value contained in the queue.


例如:

if !ds_queue_empty(move_queue)
   {
   var xx, yy;
   xx = ds_queue_dequeue(move_queue);
   yy = ds_queue_dequeue(move_queue);
   move_towards_point(xx, yy, 4);
   }

The above code checks the ds_queue indexed in the variable "move_queue" to see if it is empty, and if it is not, it then dequeues the two values from the head of the queue and use them to set a direction for movement.


上一页: Queues
下一页: ds_queue_head
© Copyright YoYo Games Ltd. 2018 All Rights Reserved